-
Notifications
You must be signed in to change notification settings - Fork 212
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Finance USD conversion mechanism − no string manipulation #1180
Finance USD conversion mechanism − no string manipulation #1180
Conversation
: new BN('-1'), | ||
amountConverted: | ||
amount && decimals && convertRates[symbol] | ||
? convertAmount(amount, decimals, 1 / convertRates[symbol]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that we can also get a convertRate
that is > 1 here (potentially, many times greater).
return formatTokenAmount( | ||
amount | ||
.mul(new BN(10).pow(new BN(CONVERT_PRECISION))) | ||
.mul(new BN(rate * 10 ** CONVERT_PRECISION)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, not entirely sure on this; you're going to get an error if rate * 10 ** CONVERT_PRECISION
becomes too large or is still an imprecise number.
No description provided.